<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8">
    <link rel="icon" href="./favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数海领航 - 外贸数据智能系统</title>
    <script>
      // 设置全局变量
      window.__INITIAL_PATH__ = window.location.pathname;
      
      // 检查URL路径和hash，确保在生产环境正确工作
      (function() {
        // 处理页面刷新时路由状态保持
        window.addEventListener('beforeunload', function() {
          // 排除资源路径
          if (!window.location.pathname.includes('/assets/') && !window.location.pathname.includes('/static/')) {
            // 保存当前路径状态
            var path = window.location.hash ? window.location.hash.substring(1) : window.location.pathname;
            if (path && path !== '/' && path !== '/login') {
              sessionStorage.setItem('spa_redirect_path', path);
            }
          }
        });

        // 检查是否有hash路由
        var path = window.location.hash;
        if (path && path.startsWith('#/')) {
          console.log('检测到hash路径:', path);
          // 已经是hash路由，不需处理
        } else {
          // 检查是否有明确的路径，如果有则转为hash路由
          path = window.location.pathname;
          if (path && path !== '/' && !path.includes('/assets/') && !path.includes('/static/')) {
            console.log('检测到普通路径，转为hash路径:', path);
            window.location.href = '#' + path;
          }
        }
      })();
      
      // 全局错误处理
      window.addEventListener('error', function(event) {
        console.error('未捕获错误:', event.message);
      });
      
      window.addEventListener('unhandledrejection', function(event) {
        console.error('Promise错误:', event.reason);
      });
    </script>
    <style>
      .app-loading {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background-color: #f5f7fa;
      }
      .app-loading-content {
        text-align: center;
      }
      .app-loading-spinner {
        width: 50px;
        height: 50px;
        border: 5px solid #1890ff;
        border-radius: 50%;
        border-top-color: transparent;
        animation: spin 1s linear infinite;
      }
      @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
      .app-loading-text {
        margin-top: 20px;
        font-size: 16px;
        color: #1890ff;
      }
    </style>
    <script type="module" crossorigin src="./assets/index-C5UoP13Z.js"></script>
    <link rel="modulepreload" crossorigin href="./assets/vendor-Dh7TmbmU.js">
    <link rel="modulepreload" crossorigin href="./assets/element-plus-BdM7iH-Y.js">
    <link rel="stylesheet" crossorigin href="./assets/index-JTif8M93.css">
  </head>
  <body>
    <div id="app">
      <div class="app-loading">
        <div class="app-loading-content">
          <div class="app-loading-spinner"></div>
          <div class="app-loading-text">数海领航系统加载中...</div>
        </div>
      </div>
    </div>
  </body>
</html> 